<?php
$path = dirname(__FILE__);
$path = explode("/", $path);
array_pop($path);
$path = implode("/", $path);
$path .= "/cache" ;
$dir_name = ".svn";

function scan($path, $level = 0){
	$rdi=new DirectoryIterator($path);
	foreach($rdi as $obj){
			if(!$obj->isDot() and !$obj->isDir() and $obj->getFilename() != ".htaccess" ){
			    $name = $obj->getPathname();
			    print($name."<br />");
					@chmod( $name, 0777 );
					unlink( $name );
			} else {
				 if( !$obj->isDot() and $obj->isDir() and  strcmp($obj->getFilename(), $dir_name) != 0 ) scan($obj->getPathname(), $level+1);
			}
	}
}


scan($path);

print("<h1>Cache clean</h1>");
exit;

?>